import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { SysDict } from './sys-dict.entity';

@Entity('sys_dict_data')
export class SysDictData {
  @PrimaryGeneratedColumn({ type: 'bigint', comment: '主键' })
  id: number;

  @Column({ length: 50, name: 'dict_code', comment: '关联字典编码，与sys_dict表中的dict_code对应' })
  dictCode: string;

  @Column({ length: 50, comment: '字典项值' })
  value: string;

  @Column({ length: 100, comment: '字典项标签' })
  label: string;

  @Column({ length: 50, name: 'tag_type', nullable: true, comment: '标签类型，用于前端样式展示（如success、warning等）' })
  tagType: string;

  @Column({ type: 'tinyint', default: 0, comment: '状态（1-正常，0-禁用）' })
  status: number;

  @Column({ type: 'int', default: 0, comment: '排序' })
  sort: number;

  @Column({ length: 255, nullable: true, comment: '备注' })
  remark: string;

  @CreateDateColumn({ name: 'create_time', comment: '创建时间' })
  createTime: Date;

  @Column({ name: 'create_by', type: 'bigint', nullable: true, comment: '创建人ID' })
  createBy: number;

  @UpdateDateColumn({ name: 'update_time', comment: '更新时间' })
  updateTime: Date;

  @Column({ name: 'update_by', type: 'bigint', nullable: true, comment: '修改人ID' })
  updateBy: number;

//   // 与字典表的关联关系
//   @ManyToOne(() => SysDict, dict => dict.dictDataList)
//   @JoinColumn({ name: 'dict_code', referencedColumnName: 'dictCode' })
//   dict: SysDict;
}